package com.ysq.tankgame;
/*
 * 坦克类
 *
 */

public class Tank {

    private int x; // 坦克的横坐标
    private int y; // 坦克的纵坐标
    private int direct; // 坦克的方向 0:向上 1:向右 2:向下 3:向左
    private int speed; // 坦克的速度

    public Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }

    
    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }



    public int getDirect() {
        return direct;
    }



    public void setDirect(int direct) {
        this.direct = direct;
    }


    public int getSpeed() {
        return speed;
    }


    public void setSpeed(int speed) {
        this.speed = speed;
    }

    /* 坦克向上移动 */
    public void moveUp(){
        y -= speed;
    }

    /* 坦克向下移动 */
    public void moveDown(){
        y += speed;
    }

    /* 坦克向左移动 */
    public void moveLeft(){
        x -= speed;
    }

    /* 坦克向右移动 */
    public void moveRight(){
        x += speed;
    }
}
